#pragma once
#include "../Ode.h"

namespace Skill
{
	namespace Ode
	{
		namespace Geometries
		{
			ref class DGeometry;
		}
	}
}
using namespace Skill::Ode::Geometries;
namespace Skill
{
	namespace Ode
	{
		ref class DVector3;
		/// <summary>
		/// brief Describe the contact point between two geoms.		
		/// If two bodies touch, or if a body touches a static feature in its 
		/// environment, the contact is represented by one or more "contact 
		/// points", described by DContactGeom.		
		/// The convention is that if body 1 is moved along the normal vector by 
		/// a distance depth (or equivalently if body 2 is moved the same distance 
		/// in the opposite direction) then the contact depth will be reduced to 
		/// zero. This means that the normal vector points "in" to body 1.
		/// </summary>
		public ref class DContactGeom : DIUnmanagedPointer
		{
			INTERNAL_CLASS_DECLARATION_NO_FINALIZE(DContactGeom,dContactGeom);
		internal:
			static array<DContactGeom^>^ _Contacts;
		public:
			static DContactGeom()
			{
				_Contacts = gcnew array<DContactGeom^>(50);
				for(int i=0;i<50;i++)
					_Contacts[i] = gcnew DContactGeom(nullptr);
			}
			UNMANAGEDPOINTER_DECLARATION();
						
			static DContactGeom^ GetContact(int index) 
			{
				return _Contacts[index];
			}			

			!DContactGeom()
			{
				if(_Free && _This)
					delete _This;
				_This = nullptr;
				_Free = false;
				_Disposed = true;
			}
			DContactGeom()
			{
				_SetPointer(new dContactGeom(),true);
			}

			static VALUE_PROP_DECLARATION_GET(int,SizeInBytes);

			/// <summary> contact position </summary>
			REF_PROP_DECLARATION_GETSET(DVector3,Position);			
			/// <summary> normal vector </summary>
			REF_PROP_DECLARATION_GETSET(DVector3,Normal);
			/// <summary> penetration depth </summary>
			VALUE_PROP_DECLARATION_GETSET(dReal,Depth);

			/// <summary> the colliding geom1 </summary>
			VALUE_PROP_DECLARATION_GETSET(DGeometry^,Geom1);
			/// <summary> the colliding geom2 </summary>
			VALUE_PROP_DECLARATION_GETSET(DGeometry^,Geom2);

			VALUE_PROP_DECLARATION_GETSET(int,Side1);
			VALUE_PROP_DECLARATION_GETSET(int,Side2);			
		};


		
	}
}